<!--
 * @Description:
 * @Author bianpengfei
 * @create 2021/4/14 13:58
 -->
<template>
  <div class="setting">
    <el-dropdown class="handle-button">
      <i class="el-icon-setting"></i>
      <el-dropdown-menu slot="dropdown">
        <el-dropdown-item @click.stop.native="onClearCache">清除本地缓存</el-dropdown-item>
        <!--        <el-dropdown-item @click.stop.native="onScrollTop">回到顶部</el-dropdown-item>-->
      </el-dropdown-menu>
    </el-dropdown>
    <el-backtop target=".main__content" :bottom="20" :visibility-height="100" style="z-index: 999">
      <div class="up-top">
        <i class="iconfont znz-icon-dingbu"></i>
      </div>
    </el-backtop>
  </div>
</template>

<script>
import { clearLocalStorageExclude } from '@/libs/utils/util'

export default {
  name: 'Index',
  data() {
    return {}
  },

  computed: {},

  mounted() {},

  beforeDestroy () {},

  methods: {
    onClearCache () {
      clearLocalStorageExclude()
      this.$notify.success({
        title: '提示',
        message: '清除缓存成功',
        position: 'bottom-right'
      })
      window.location.reload()
    },
    onScrollTop () {
      let scrollView = document.querySelector('.main__content')
      scrollView?.scroll({
        top: 0,
        left: 0,
        behavior: 'smooth'
      })
    }
  }
}
</script>
